home *** CD-ROM | disk | FTP | other *** search
/ Champak 146 / (Vol 146) Jan 07 2012.iso / Games / super_fly.swf / scripts / DefineSprite_71 / frame_22 / DoAction.as
Text File  |  2012-01-07  |  2KB  |  94 lines

  1. call("pickAfly");
  2. mouse_x = getProperty("../flyin" add pickedOff add "/fly1", _X);
  3. mouse_y = getProperty("../flyin" add pickedOff add "/fly1", _Y);
  4. tellTarget("../flyin" add pickedOff)
  5. {
  6.    gotoAndStop(1);
  7. }
  8. s_x = getProperty("../fTong", _X);
  9. s_y = getProperty("../fTong", _Y);
  10. x_dist = mouse_x - s_x;
  11. y_dist = mouse_y - s_y;
  12. input = y_dist * y_dist + x_dist * x_dist;
  13. call("sqroot");
  14. tongLength = tongLength;
  15. pi = "3.1416";
  16. deltax = mouse_x - s_x;
  17. deltay = mouse_y - s_y;
  18. ratio = deltay / deltax;
  19. if("0" < deltax)
  20. {
  21.    if("1" < ratio)
  22.    {
  23.       input = "1" / ratio;
  24.       call("arctan");
  25.       angle = "90" - output * "180" / pi;
  26.    }
  27.    else if("0" < ratio and ratio < "1")
  28.    {
  29.       input = ratio;
  30.       call("arctan");
  31.       angle = output * "180" / "3.14";
  32.    }
  33.    else if(ratio < "0" and - "1" < ratio)
  34.    {
  35.       input = ratio;
  36.       call("arctan");
  37.       angle = "360" + output * "180" / "3.14";
  38.    }
  39.    else if(ratio < - "1")
  40.    {
  41.       input = "1" / ratio;
  42.       call("arctan");
  43.       angle = "270" - output * "180" / pi;
  44.    }
  45. }
  46. else if(deltax < "0")
  47. {
  48.    if("1" < ratio)
  49.    {
  50.       input = "1" / ratio;
  51.       call("arctan");
  52.       angle = "270" - output * "180" / pi;
  53.    }
  54.    else if("0" < ratio and ratio < "1")
  55.    {
  56.       input = ratio;
  57.       call("arctan");
  58.       angle = "180" + output * "180" / "3.14";
  59.    }
  60.    else if(ratio < "0" and - "1" < ratio)
  61.    {
  62.       input = ratio;
  63.       call("arctan");
  64.       angle = "180" + output * "180" / "3.14";
  65.    }
  66.    else if(ratio < - "1")
  67.    {
  68.       input = "1" / ratio;
  69.       call("arctan");
  70.       angle = "90" - output * "180" / pi;
  71.    }
  72. }
  73. else if(deltax == "0")
  74. {
  75.    if("0" < deltay)
  76.    {
  77.       angle = "90";
  78.    }
  79.    else if(deltay < "0")
  80.    {
  81.       angle = - "90";
  82.    }
  83.    else if(deltay == "0")
  84.    {
  85.       angle = "null";
  86.    }
  87. }
  88. setProperty("fline", _rotation, angle);
  89. set("fline:tongLength",tongLength);
  90. tellTarget("fline")
  91. {
  92.    gotoAndPlay(2);
  93. }
  94.